package exam.business.service;

import exam.common.constant.ResultPort;
import exam.common.key.KeyExamination;
import exam.common.util.ConvertUtils;
import exam.common.util.NullCheckUtil;
import exam.model.dao.TExaminationDAO;
import exam.model.entity.TExaminationEntity;
import exam.system.business.AbstractService;
import exam.system.business.BusinessServiceInfo;

public class ExaminationGetInfoService extends AbstractService {
	// tExaminationDAO
	private TExaminationDAO tExaminationDAO = new TExaminationDAO();
	@Override
	public String executeService(BusinessServiceInfo serviceInfo)
			throws Exception {
		// lay examId tu serviceInfo
		String examId = serviceInfo.getString(KeyExamination.EXAM_ID);
		TExaminationEntity tExaminationEntity = tExaminationDAO
				.selectByPk(ConvertUtils.convertStringToLong(examId));
		if(NullCheckUtil.isNull(tExaminationEntity)) {
			return ResultPort.NONE;
		}
		// put tExaminationEntity vao serviceInfo
		serviceInfo.put(KeyExamination.T_EXAMINATION_ENTITY, tExaminationEntity);
		return ResultPort.SUCCESS;
	}

}
